from abc import abstractmethod
from transaction import Transaction
from payroll_database import PayrollDatabase
from employee import Employee
from payment_classification import PaymentClassification
from payment_schedule import PaymentSchedule
from payment_method import PaymentMethod

class AddEmployeeTransaction(Transaction):
    def __init__(self) -> None:
        self.db = PayrollDatabase()
        pass

    def add_employee_transaction(self, emp_id:int, name, address) -> None:
        self.emp_id = emp_id
        self.name = name
        self.address = address
        pass

    @abstractmethod
    def get_classification(self) -> PaymentClassification:
        pass

    @abstractmethod
    def get_schedule(self) -> PaymentSchedule:
        pass
    
    def execute(self) -> None:
        self.pc = self.get_classification()
        self.ps = self.get_schedule()
        self.pm = PaymentMethod()

        self.e = Employee(self.emp_id, self.name, self.address)
        self.e.set_classification(self.pc)
        self.e.set_schedule(self.ps)
        self.e.set_method(self.pm)

        self.db.add_employee(self.emp_id, self.e)